package com.zhilong;

import android.app.Activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.widget.TextView;

import com.zhiyun.R;

public class CounterDown extends Activity {
	private void done()
	{
		Log.i(getClass().getName(), "returning form counter down");
		finish();
	}
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.counter);
        
        new CountDownTimer(3000, 1000) {
   	     public void onTick(long millisUntilFinished) {
   	    	 ((TextView)findViewById(R.id.tvCounter)).setText("" + millisUntilFinished/1000);
   	     }

   	     public void onFinish() {
   	    	 ((TextView)findViewById(R.id.tvCounter)).setText("0");
   	         done();
   	     }
   	  }.start();
    }
}